package keni.html.android.framework.metadata;

import java.util.ArrayList;
import java.util.List;

import keni.html.android.framework.util.Constants;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;



public class PageMetadata extends FieldContainer {
	
	public String getUrl() {
		return getProperities().get(Constants.MetadataTagName.URL);
	}
	 
	 List<PanelMetadata> panels=new ArrayList<PanelMetadata>();
	 List<CarouselMetadata> carousels=new ArrayList<CarouselMetadata>();
	 
	 public List<PanelMetadata> getPanels() {
		return panels;
	}
	 public List<CarouselMetadata> getCarousels()
	 {
		 return carousels;
	 }
	 
	 @Override
	public JSONObject convertToJsonObject() throws JSONException {
		JSONObject jsonObject=super.convertToJsonObject();
	
		JSONArray panelJsonArray=new JSONArray();
		for (PanelMetadata panelMetadata : getPanels()) {
			panelJsonArray.put(panelMetadata.convertToJsonObject());
		}
	
		jsonObject.put(Constants.JsonObjectKeys.PANELS, panelJsonArray);
		return jsonObject;
	}


}
